PuLP How-to
(Draft)
Date: 2-15-2023
This page includes the following items and is based on PuLP documentations.
How to install PuLP on csusb-hpc.
How to run PuLP.
How to add GUROBI.
Note
GUROBI
is a licensed program. They offer education licenses for free, but one needs to create an [account](https://www.gurobi.com/) and get the license on a campus network.
Installation
If it is not already installed, use the following command to install PuLP via [PyPI](https://pypi.org/project/PuLP/) and run a check.
pip install https://pypi.org/project/PuLP/
pulptest
Instead, one can install it in JupyterLab as follows.
%pip install pulp
import pulp as pl
pl.pulpTestAll()
Multi-threads
PuLP utilized multiple cores via the solvers’ thread option.
cbc_solver = PULP_CBC_CMD(threads=4)
Change the number of threads to the number of cores requested.
Note
In the test, 32 cores seemed to be the most reasonable as the number of trees becomes smaller. Also, it did not use much RAM. So, 16 GB should be a safe choice.
Note
When this page was written, according to the web search, there was no practical way to use GPUs for PuLP. See this article https://stackoverflow.com/questions/73096443/using-colab-gpu-for-pulp-python.
GUROBI solver
In our testing, GUROBI solver caused an error with pulptest
. As a default, only package paths are added into the stack-pulp-test
. To install GUROBI, simply run
conda install gurobi=10.0.1
Or in JupyterLab,
%conda install gurobi=10.0.1
# %ensures that it is installed in the right conda environment.
To use GUROBI on the server, one needs WSL
license. It supports up to 8 threads. (It is free for educational use.) Once you have the gurobi.lic file, please it into your home folder (likely ~\jobyan\
).
gurobi_solver = GUROBI_CMD(threads=8)